// 将年月的日期转换成为带有 年-月-日 时-分-秒的格式
const toDateString = (beginTime: string, endTime)=>{
    let month = parseInt(endTime.split('-')[1]);
    let year = parseInt(endTime.split('-')[0]);
    beginTime = beginTime + '-01 00:00:00';
    switch (month) {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            endTime = endTime + '-31 23:59:59';
            break;
        case 2:
            if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
                endTime = endTime + '-29 23:59:59';
            } else {
                endTime = endTime + '-28 23:59:59';
            }
            break;
        default:
            endTime = endTime + '-30 23:59:59';
            break;
    }
    return [beginTime, endTime];
}
// 检查一个对象中是否存在有效值
const checkObj = (object: any):boolean => {
    for (let key in object) {
        if (object[key] && !(object[key] instanceof Array) && key !== 'checkTime' && key !== 'brandCode') {
            return true;
        } else if ((object[key] instanceof Array) && object[key].length > 0 && key !== 'checkTime') {
            return true;
        }
    }
    return false;
}
// 导出文件使用的方法
export {toDateString, checkObj}